home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
bsrc_250.zip
/
BTCONFIG.C
< prev
next >
Wrap
Text File
|
1991-09-15
|
38KB
|
1,156 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software, Co. */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / Freely Available<tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
/* */
/* */
/* This module was written by Vince Perriello */
/* */
/* */
/* BinkleyTerm Configuration File Parser */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.250. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */
/* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */
/* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */
/* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */
/* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */
/* */
/* */
/* You can contact Bit Bucket Software Co. at any one of the following */
/* addresses: */
/* */
/* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */
/* P.O. Box 460398 AlterNet 7:491/0 */
/* Aurora, CO 80046 BBS-Net 86:2030/1 */
/* Internet f491.n343.z1.fidonet.org */
/* */
/* Please feel free to contact us at any time to share your comments about */
/* our software and/or licensing policies. */
/* */
/*--------------------------------------------------------------------------*/
/* Include this file before any other includes or defines! */
#include "includes.h"
char *ctl_slash_string (char *);
static int Zone = 1;
void cfg_macro (char *);
void cfg_dial_string (char *);
void cfg_mdm_trans (char *);
void cfg_domain (char *);
void cfg_Janus (char *);
void parse_config (char *config_file)
{
FILE *stream;
char temp[256];
char *c;
int i;
unsigned temp_num;
char *p;
ADDR temp_addr; /* Used to get address */
(void) sprintf (temp, "%s%s", BINKpath, config_file);
if ((stream = share_fopen (temp, "rt", DENY_WRITE)) == NULL) /* OK, let's open the file */
return; /* no file, no work to do */
while ((fgets (temp, 255, stream)) != NULL) /* Now we parse the file ... */
{
c = temp; /* Check out the first char */
if ((*c == '%') || (*c == ';')) /* See if it's a comment
* line */
continue;
i = (int) strlen (temp); /* how long this line is */
if (i < 3)
continue; /* If too short, ignore it */
c = &temp[--i]; /* point at last character */
if (*c == '\n') /* if it's a newline, */
*c = '\0'; /* strip it off */
if ((i = parse (temp, config_lines)) != 0)
{
c = &temp [(config_lines [i - 1]).p_length];
}
switch (i)
{
case 1: /* "SameRing" */
modemring = 1;
break;
case 2: /* "NewNodeList" */
case 129: /* "Version6" */
newnodelist = 1;
break;
case 3: /* "QuickNodeList" */
#ifdef QUICK_LIST
nodefunc = QuickLookup;
newnodelist = 0;
#endif
break;
case 4: /* "Answerback" */
answerback = ctl_string (c);
break;
case 5: /* "Macro" */
cfg_macro (c);
break;
case 6: /* "Shell" */
c = skip_blanks (c);
i = atoi (c);
if ((i <= 0) || (i > 9))
{
(void) printf ("%s %d %s\n", MSG_TXT(M_SHELL_NUMBER), i, MSG_TXT(M_OUT_OF_RANGE));
break;
}
c = skip_to_blank (c);
c = skip_blanks (c);
shells[i - 1] = calloc (1, strlen (c) + 1);
(void) strcpy (shells[i - 1], c);
(void) strupr (shells[i - 1]);
break;
case 7: /* "Dial" */
cfg_dial_string (c);
break;
case 8: /* "Event" */
c = skip_blanks (c);
(void) parse_event (c);
break;
case 9: /* "Zone" */
c = skip_blanks (c);
Zone = atoi (c);
if (!Zone) /* if we didn't find a zone */
(void) printf (MSG_TXT(M_ILLEGAL_ZONE), &temp[4]);
break;
case 10: /* "MaxReq" */
(void) sscanf (c, "%d %d", &DEFAULT.rq_Limit, &DEFAULT.rq_Cum_Limit);
if (!DEFAULT.rq_Limit) /* No requests??? */
(void) printf ("0 %s\n", MSG_TXT(M_REQUESTS_ALLOWED));
break;
case 11: /* "LogLevel" */
c = skip_blanks (c);
i = atoi (c);
if ((i <= 5) && (i > 0))
{
loglevel = i;
}
else
{
(void) printf (MSG_TXT(M_BAD_LOGLEVEL), &temp[8]);
}
break;
case 12: /* "Baud" */
temp_num = (unsigned int) atoi (c);
max_baud.rate_value = 0;
for (i = 0; btypes[i].rate_value; i++)
{
if (btypes[i].rate_value == temp_num)
{
max_baud.rate_mask = btypes[i].rate_mask;